home *** CD-ROM | disk | FTP | other *** search
/ CD BIT 75 / CD BIT 75.iso / Software / ooo / f_0020 / sbasic.jar / text / sbasic / common / 03090203.xml < prev    next >
Encoding:
Extensible Markup Language  |  2003-08-01  |  4.0 KB  |  31 lines

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <html><head><title>While...Wend Statement[Runtime]</title><meta name="filename" content="text/sbasic/common/03090203"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
  3.  
  4.         p.P1{
  5.                 }
  6.         span.T1{
  7.                 font-weight:bold;}
  8.         </style></head><body>
  9.   
  10.   
  11.   <help:paragraphinfo state="E" xmlns:help="http://openoffice.org/2000/help"/><help:to-be-embedded Eid="whilewend" xmlns:help="http://openoffice.org/2000/help">
  12.   <p class="Head1"><help:paragraphinfo state="U" number="1"/><help:key-word value="While; While...Wend loop" tag="kw66562_1"/><help:link Id="66562">While...Wend Statement[Runtime]</help:link></p>
  13.   <p class="Paragraph"><help:paragraphinfo state="U" number="2"/>When a program encounters a While statement, it tests the condition. If the condition is False, the program continues directly following the Wend statement. If the condition is True, the loop is executed until the program finds Wend and then jumps back to the<span style="font-weight:bold;"> While </span>statement. If the condition is still True, the loop is executed again.</p>
  14.   <help:paragraphinfo state="E"/></help:to-be-embedded>
  15.   <p class="Paragraph"><help:paragraphinfo state="U" number="3" xmlns:help="http://openoffice.org/2000/help"/>Unlike the <help:link Id="66463" Eid="doloop" xmlns:help="http://openoffice.org/2000/help">Do...Loop</help:link> statement, you cannot cancel a <span class="T1">While...Wend</span> loop with <help:link Id="66590" Eid="exit" xmlns:help="http://openoffice.org/2000/help">Exit</help:link>. Never exit a While...Wend loop with <help:link Id="66534" Eid="goto" xmlns:help="http://openoffice.org/2000/help">GoTo</help:link>, since this can cause a run-time error.</p>
  16.   <p class="Paragraph"><help:paragraphinfo state="U" number="4" xmlns:help="http://openoffice.org/2000/help"/>A Do...Loop is more flexible than a While...Wend.</p>
  17.   <p class="Head2"><help:paragraphinfo state="U" number="5" xmlns:help="http://openoffice.org/2000/help"/>Syntax:</p>
  18.   <p class="Paragraph"><help:paragraphinfo state="U" number="6" xmlns:help="http://openoffice.org/2000/help"/>While Condition [Statement] Wend</p>
  19.   <p class="Head2"><help:paragraphinfo state="U" number="7" xmlns:help="http://openoffice.org/2000/help"/>Example:</p>
  20.   <p class="PropText"><help:paragraphinfo state="U" number="8" xmlns:help="http://openoffice.org/2000/help"/>Sub ExampleWhileWend</p>
  21.   <p class="PropText"><help:paragraphinfo state="U" number="9" xmlns:help="http://openoffice.org/2000/help"/>Dim stext As String</p>
  22.   <p class="PropText"><help:paragraphinfo state="U" number="10" xmlns:help="http://openoffice.org/2000/help"/>Dim iRun As Integer</p>
  23.   <p class="PropText"><help:paragraphinfo state="U" number="11" xmlns:help="http://openoffice.org/2000/help"/>sText ="This is a short text"</p>
  24.   <p class="PropText"><help:paragraphinfo state="U" number="12" xmlns:help="http://openoffice.org/2000/help"/>iRun = 1</p>
  25.   <p class="PropText"><help:paragraphinfo state="U" number="13" xmlns:help="http://openoffice.org/2000/help"/>while iRun < Len(sText)</p>
  26.   <p class="PropText"><help:paragraphinfo state="U" number="14" xmlns:help="http://openoffice.org/2000/help"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>if Mid(sText,iRun,1 )<> " " then Mid( sText ,iRun, 1, Chr( 1 + Asc( Mid(sText,iRun,1 )) )</p>
  27.   <p class="PropText"><help:paragraphinfo state="U" number="15" xmlns:help="http://openoffice.org/2000/help"/><text:tab-stop xmlns:text="http://openoffice.org/2000/text"/>iRun = iRun + 1</p>
  28.   <p class="PropText"><help:paragraphinfo state="U" number="16" xmlns:help="http://openoffice.org/2000/help"/>Wend</p>
  29.   <p class="PropText"><help:paragraphinfo state="U" number="17" xmlns:help="http://openoffice.org/2000/help"/>MsgBox sText,0,"Text encoded"</p>
  30.   <p class="PropText"><help:paragraphinfo state="U" number="18" xmlns:help="http://openoffice.org/2000/help"/>end sub</p>
  31.  </body></html>